/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package org.ipti.br.tag.bean.lazy;

import org.ipti.br.tag.dao.ActorFacade;
import org.ipti.br.tag.entity.Actor;
import java.util.List;
import java.util.Map;
import org.primefaces.model.LazyDataModel;
import org.primefaces.model.SortOrder;

/**
 *
 * @author israel
 */
public class LazyActorPerUnityScheduleDataModel extends LazyDataModel<Actor> {

    private List<Long> unitySchedules;
    private ActorFacade actorDAO;

    public LazyActorPerUnityScheduleDataModel(List<Long> unitySchedules, ActorFacade actorDAO) {
        this.unitySchedules = unitySchedules;
        this.actorDAO = actorDAO;
    }

    @Override
    public List<Actor> load(int first, int pageSize, String sortField, SortOrder sortOrder, Map<String, String> filters) {
        return actorDAO.searchActorActivatedPerUnitySchedule(unitySchedules, first, pageSize, filters);
    }

    @Override
    public int getRowCount() {
        return actorDAO.getActorCountPerUnitySchedule(unitySchedules);
    }

    public ActorFacade getActorDAO() {
        return actorDAO;
    }

    public void setActorDAO(ActorFacade actorDAO) {
        this.actorDAO = actorDAO;
    }

    public List<Long> getUnitySchedules() {
        return unitySchedules;
    }

    public void setUnitySchedules(List<Long> unitySchedules) {
        this.unitySchedules = unitySchedules;
    }
}
